<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
	<meta http-equiv="content-type" content="text/html; charset=UTF-8">
	<meta charset="utf-8">
	<title>显示结果 - ${siteName}</title>
	<meta name="description" content="">
	<meta name="author" content="xuzewei">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no">
	<link rel="stylesheet" type="text/css" href="css/cloud-admin.css" >
	<link rel="stylesheet" type="text/css" href="css/themes/default.css" id="skin-switcher" >
	<link rel="stylesheet" type="text/css" href="css/responsive.css" >
	<link rel="stylesheet" type="text/css" href="font-awesome/css/font-awesome.min.css">
	<!-- JQUERY UI-->
	<link rel="stylesheet" type="text/css" href="js/jquery-ui-1.10.3.custom/css/custom-theme/jquery-ui-1.10.3.custom.min.css" />
	<!-- DATE RANGE PICKER -->
	<link rel="stylesheet" type="text/css" href="js/bootstrap-daterangepicker/daterangepicker-bs3.css" />
	<!-- JQGRID -->
	<link rel="stylesheet" type="text/css" href="js/jqgrid/css/ui.jqgrid.min.css" />
	<!-- HUBSPOT MESSENGER -->
	<link rel="stylesheet" type="text/css" href="js/hubspot-messenger/css/messenger.min.css" />
	<link rel="stylesheet" type="text/css" href="js/hubspot-messenger/css/messenger-theme-flat.min.css" />
</head>
<body id="app" ng-app="app" ng-controller="ctrl">
	<!-- HEADER -->
	<jsp:include page="include/header.jsp" />
	<!--/HEADER -->
	<!-- PAGE -->
	<section id="page">
		<!-- /SIDEBAR -->
		<div id="main-content">
			<div class="container">
				<div class="row">
					<div id="content" class="col-lg-12">
						<!-- PAGE HEADER-->
						<div class="row">
							<div class="col-sm-12">
								<div class="page-header">
									<!-- BREADCRUMBS -->
									<ul class="breadcrumb">
										<li>
											<i class="fa fa-home"></i>
											<a href="welcome.jsp">Home</a>
										</li>
									</ul>
									<!-- /BREADCRUMBS -->
									<div class="clearfix">
										<h3 class="content-title pull-left">文件列表 </h3>
									</div>
									<div class="description"></div>
								</div>
							</div>
						</div>
						<!-- /PAGE HEADER -->
						<hr class="hr-normal">
						<div class="box border blue">
							<div class="box-title">
								<h4><i class="fa fa-bars"></i>文件列表 </h4>
								<select ng-model="pagerReq.pageSize">
									<option value="10">每页显示10条</option>
									<option value="20">每页显示20条</option>
									<option value="50">每页显示50条</option>
									<option value="100">每页显示100条</option>
									<option value="500">每页显示500条</option>
									<option value="1000">每页显示1000条</option>
									<option value="5000">每页显示5000条</option>
									<option value="10000">每页显示10000条</option>
								</select>
								<div class="tools">
									<a href="javascript:;" class="reload" id="reload" ng-click="reload()">
										<i class="fa fa-refresh"></i>
									</a>
								</div>
							</div>
							<div class="box-body">
								<table class="table table-striped">
									<thead>
									  <tr>
										<th>操作</th>
										<th>关键字</th>
										<th>文本内容</th>
									  </tr>
									</thead>
									<tbody>
									  <tr ng-repeat="x in pagerResp.list">
										<td>
											<button class="btn btn-xs btn-warning" ng-click="gotoSeePage(x.kWordId)" >查看详情</button>
										</td>
										<td>{{x.kWords}}</td>
										<td>{{x.content}}</td>
									  </tr>
									</tbody>
								  </table>
							</div>
							<div class='text-center'>
								<ul class='pagination'>
								  <li ng-class="{'disabled':pager.pageup.isDisabled}" ng-click="pageup()">
									<a href="javascript:;">
									  <i class='fa fa-angle-left'></i>
									</a>
								  </li>
								  <li ng-repeat="x in pager.pages" ng-class="{'active':x.pageIndex==pager.activePageIndex}" ng-click="toPage(x.pageIndex)">
									<a href="javascript:;">{{x.pageLabel}}</a>
								  </li>
								  <li ng-if="!pager.pagedown.isDisabled">
									<a href="javascript:;">...</a>
								  </li>
								  <li ng-class="{'disabled':pager.pagedown.isDisabled}" ng-click="pagedown()">
									<a href="javascript:;">
									  <i class='fa fa-angle-right'></i>
									</a>
								  </li>
								</ul>
							</div>
						</div>
						<div class="footer-tools">
							<span class="go-top">
								<i class="fa fa-chevron-up"></i> Top
							</span>
						</div>
					</div><!-- /CONTENT-->
				</div>
			</div>
		</div>
	</section>
	<!--/PAGE -->
	
	<!-- JAVASCRIPTS -->
	<!-- Placed at the end of the document so the pages load faster -->
	<!-- JQUERY -->
	<script src="js/jquery/jquery-2.0.3.min.js"></script>
	<!-- JQUERY UI-->
	<script src="js/jquery-ui-1.10.3.custom/js/jquery-ui-1.10.3.custom.min.js"></script>
	<!-- BOOTSTRAP -->
	<script src="bootstrap-dist/js/bootstrap.min.js"></script>
	<!-- DATE RANGE PICKER -->
	<script src="js/bootstrap-daterangepicker/moment.min.js"></script>
	<script src="js/bootstrap-daterangepicker/daterangepicker.min.js"></script>
	<!-- SLIMSCROLL -->
	<script type="text/javascript" src="js/jQuery-slimScroll-1.3.0/jquery.slimscroll.min.js"></script>
	<script type="text/javascript" src="js/jQuery-slimScroll-1.3.0/slimScrollHorizontal.min.js"></script>
	<!-- BLOCK UI -->
	<script type="text/javascript" src="js/jQuery-BlockUI/jquery.blockUI.min.js"></script>
	<!-- JQGRID -->
	<script type="text/javascript" src="js/jqgrid/js/grid.locale-en.min.js"></script>
	<script type="text/javascript" src="js/jqgrid/js/jquery.jqGrid.min.js"></script>
	<!-- COOKIE -->
	<script type="text/javascript" src="js/jQuery-Cookie/jquery.cookie.min.js"></script>
	<!-- HUBSPOT MESSENGER -->
	<script type="text/javascript" src="js/hubspot-messenger/js/messenger.min.js"></script>
	<script type="text/javascript" src="js/hubspot-messenger/js/messenger-theme-flat.js"></script>
	<script type="text/javascript" src="js/hubspot-messenger/js/messenger-theme-future.js"></script>
	<!-- ANGULAR-LIBRARY -->
	<script src="angular-1.5.0-rc.2/angular.js"></script>
	<script src="js/script.js"></script>
	<!-- CUSTOM SCRIPT -->
	<script src="include/common.js"></script>
	<script>
	var app = angular.module("app", []);
	app.controller('ctrl', function($scope, $http, $httpParamSerializer, $injector, $window) {
		
		$scope.reloadType = "list";
		
		$scope.pagerReq = {
			"pageSize": "20"
		};
		
		$scope.pager = {
			"pageup": {"isDisabled": true},
			"pages": [],
			"pagedown": {"isDisabled": true},
			"activePageIndex": 0
		};
		
		//条件查询
		
		$scope.search = function(pageIndex) {
			console.log('${param.need}');
			$scope.reloadType = "search";
			var reqDate = jQuery.param({
				"kwords": '${param.need}',
			});
			var reqConfig = { headers: { "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"} };
			$http.post(
				"api/keysAcion/search", reqDate, reqConfig
			).success(function(data, status) {
				if (isErr(data)) {
					showErrMsg(data);
					return;
				}
				$scope.pagerResp = data.response;
				$scope.updatePager();
			}).error(function(data, status) {
				showNetworkErrMsg(data, status);
			});
		}
		

		
		//查看信息
		$scope.gotoSeePage = function(id) {
			$window.location.href = "kword_see.jsp?id=" + id;
		};
		
		//退出
		$scope.logout = function() {
			logout($window);
		};
		
		$scope.reload = function(pageIndex) {
				$scope.search(pageIndex);
		};
		
		//分页
		$scope.updatePager = function() {
			updatePager($scope);
		}
		
		$scope.toPage = function(pageIndex) {
			
			toPage(pageIndex, $scope);
		}
		
		$scope.pageup = function() {
			pageup($scope);
		}
		
		$scope.pagedown = function() {
			pagedown($scope);
		}
	});
	</script>
	<script>
	jQuery(document).ready(function() {
		App.init();
		jQuery('#nav_article').click();
		setTimeout(function () { 
			var scope = angular.element('#app').scope();
			scope.reload();
		}, 500);
	});
	</script>
	<!-- /JAVASCRIPTS -->
</body>
</html>